package com.example.demo.controller.other;

import com.easy.tool.utils.date.DateUtils;
import com.example.demo.entity.userTest;
import com.example.demo.service.userTestService;
import com.example.demo.utils.IpUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.util.Date;
import java.util.List;

/**
 * @author 高俊
 * @create 2021-07-2021/7/20-18:47
 */
@Controller
@RequestMapping("/tt")
public class userController {

    @Autowired
    private userTestService userTestService;

    @ResponseBody
    @RequestMapping("/select")
    public List<userTest> select(){
        List<userTest> select = userTestService.select();
        return select;
    }

    @ResponseBody
    @RequestMapping("/select/one")
    public userTest selectOne(){
        userTest select = userTestService.selectOne();
        return select;
    }

    @ResponseBody
    @RequestMapping("/get/now/date")
    public String getNowDate(HttpServletRequest request) throws Exception{
        String ip = IpUtils.getIpAddr(request);
        return ip;
    }
}
